package tpf.designer.pattern.course10.homework.exercise2;

import java.util.Random;

public class SelfProducer implements Runnable {

    private final SelfQueue selfQueue;

    public SelfProducer(SelfQueue selfQueue) {
        this.selfQueue = selfQueue;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            Random random = new Random();
            int ProdRandom=random.nextInt(10);
            System.out.println("Produced: " + ProdRandom);
            selfQueue.produce(ProdRandom);
        }
    }
}
